#ifndef _MY_SERIALIZE_H
#define _MY_SERIALIZE_H
#include <sys/types.h>
int serialize_char(char* buffer,int offset,char data);

int unserialize_char(char* result,char* buffer,int offset);

int serialize_short(char* buffer,int offset,short data);

int unserialize_short(short* result,const char* buffer,int offset);

int serialize_int(char* buffer,int offset,int data);

int unserialize_int(int* result,const char* buffer,int offset);

int serialize_string(char* buffer,int offset,const char* data);

int unserialize_string(char* result,const char* buffer,int offset);

int serialize_arr_ch(char* buffer,int offset,const char* data,int n);

int unserialize_arr_ch(char* result,int* len,const char* buffer,int offset);

// 检查系统是大端还是小端
int check_endianness();

u_int64_t htonll(u_int64_t _netlong);

u_int64_t ntohll(u_int64_t _netlong);

int serialize_uint64_t(char* buffer,int offset,u_int64_t data);

int unserialize_uint64_t(u_int64_t* result,const char* buffer,int offset);
#endif